<?php 
	include_once("session.php"); 
	include_once("util/message.php");
    include_once("util/constant.php"); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>Tin tức</title>
<?php include("import.php"); ?>
</head>

<body>

<!-- Wrapper -->
<div class="wrapper">
	<!-- Floating banner -->
    <?php include("floating-banner.php");?>
    <!-- End of floating banner -->
    
	<!-- Top banner -->
	<?php include("header.php");?>
    <!-- End of top banner -->
    
    <!-- Navigator -->
	<?php include("navigator.php");?>
    <!-- End of navigator -->
    
    <!-- Menu, newsletter and search -->
    <?php include("menu.php");?>
    <!-- End of menu, newsletter and search -->
    
    <!-- Content -->
    <div class="wrapper-content">
    
    	<!-- Breadcrumb -->
        <?php include("breadcrumb.php");?>
        <!-- End of breadcrumb -->
    
    	<!-- News -->
    	<div id="news_list">
        </div>
        <!-- End of news -->
        
        <!-- Paging -->
        <!--
        <div class="index-paging-wrapper">
        <div class="paging">
                <ul>
                    <li class="active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">5</a></li>
                    <li><a href="#">6</a></li>
                    <li><a href="#">...</a></li>
                </ul>
            </div>
        </div>
        -->
        <?php
        $articles = getArticleOfPage(isset($_GET["page"])?$_GET["page"]:0,null,null);
        
        $numbOfArticles = mysql_num_rows($articles);
        ?>
        <div id="example_paging" class="paging"></div>
        <script type='text/javascript'>
            var options = {
                alignment:"right",
                currentPage: 1,
                totalPages: <?php echo ceil($numbOfArticles / 3); ?>,
                onPageClicked: function(e,originalEvent,type,page){
                    $.ajax({
                        type: "GET",
                        url: "./action/ajax/getArticle.php",
                        data: { page:<?php echo isset($_GET["page"])?$_GET["page"]:0 ?> , p:page }
                    }).done(function( data ) {
                        $("#news_list").empty();
                        $("#news_list").html(data);
                    });
                }
            }
    
            $('#example_paging').bootstrapPaginator(options);
        </script>
        
        <!-- End of paging -->
    </div>
    <!-- End of content -->
    
    <!-- Live support -->
        <?php include("live-support.php");?>
    <!-- End of live support -->
    <div class="clear"></div>
	<?php include("footer.php");?>
</div>
<!-- End of wrapper -->
<script>
    $(document).ready(function(){
        $.ajax({
            type: "GET",
            url: "./action/ajax/getArticle.php",
            data: {page:<?php echo isset($_GET["page"])?$_GET["page"]:0; ?>}
        }).done(function( data ) {
            $("#news_list").html(data);
            
            $('.wrapper-news-content img').each(function(){
                $(this).hide();
            });
        });
    });
</script>
</body>
</html>